﻿package mortal.game.view.common.pageSelect
{

    public class SpecialPageTool extends Object
    {
        private var _maxLenght:int;
        private var _data:Array;
        private var _showData:Array;
        private var _curIndex:int;

        public function SpecialPageTool()
        {
            return;
        }// end function

        public function set data(param1:Array) : void
        {
            this._data = param1;
            if (param1.length < this._maxLenght)
            {
                this._showData = param1;
            }
            else
            {
                this._showData = param1.slice(0, this._maxLenght);
            }
            return;
        }// end function

        public function get data() : Array
        {
            return this._data;
        }// end function

        public function get showData() : Array
        {
            return this._showData;
        }// end function

        public function set maxLenght(param1:int) : void
        {
            this._maxLenght = param1;
            return;
        }// end function

        public function advance() : Array
        {
            var _loc_1:* = this._curIndex + 1;
            if (this._data.length < _loc_1 + this._maxLenght)
            {
                this._showData = this._data;
                this._showData = this._data.length < this._maxLenght ? (this._data) : (this._data.slice(this._data.length - this._maxLenght, (this._maxLenght + 1)));
            }
            else
            {
                var _loc_2:String = this;
                var _loc_3:* = this._curIndex + 1;
                _loc_2._curIndex = _loc_3;
                this._showData = this._data.slice(_loc_1, _loc_1 + this._maxLenght);
            }
            return this._showData;
        }// end function

        public function retreat() : Array
        {
            var _loc_1:* = this._curIndex - 1;
            if (this._curIndex <= 0)
            {
                this._showData = this._data.length < this._maxLenght ? (this._data) : (this._data.slice(0, this._maxLenght));
            }
            else
            {
                var _loc_2:String = this;
                var _loc_3:* = this._curIndex - 1;
                _loc_2._curIndex = _loc_3;
                this._showData = this._data.slice(_loc_1, _loc_1 + this._maxLenght);
            }
            return this._showData;
        }// end function

    }
}
